﻿using System;
using System.Collections.Generic;
using Color = System.Drawing.Color;
using SwinGame;

namespace Gundam_2._0_Alpha.src
{
    public class Melee:CharacterAction
    {
        private int minDamage;
        private bool isPlayer;

        public Melee(Character c, bool persistant, int row, int colEnd, int count, int lockoutLevel, int minDamage, bool isPlayer)
            : base(c, persistant, row, colEnd, count, lockoutLevel)
        {
            this.minDamage = minDamage;
            this.isPlayer = isPlayer;
        }

        public override void DoAction(GameController gc)
        {
            if (!IsActive)
            {
                IsActive = true;
                c.GlobalLockout = true;
                c.LockoutTiers[LockoutLevel] = true;
                GlobalConst.Utils.ActivateAnimationRow(c.ObjectSprite, row + c.offSetSpriteRow(), colEnd, count);
            }

            if (c.ObjectSprite.CurrentCell >= ((c.offSetSpriteRow() + row) * c.ObjectSprite.Columns + colEnd) - 1)
                Reset(gc);

            GlobalConst.DmgCheck.CheckDamage(gc.GameStages.Peek().CharList, c, isPlayer, minDamage, gc, false, 0);
        }

        public override void Reset(GameController gc)
        {
            IsActive = false;
            c.LockoutTiers[LockoutLevel] = false;
            c.GlobalLockout = false;
            GlobalConst.Utils.ActivateAnimationRow(c.ObjectSprite, c.offSetSpriteRow(), GlobalConst.DefaultColEnd, GlobalConst.DefaultFPC);
        
        }

    }
}
